package com.zzb.projectfactory.framework.role.entity;

import com.zzb.projectfactory.framework.autodoc.annotation.AutoDocField;
import com.zzb.projectfactory.framework.common.BaseEntity;
import com.zzb.projectfactory.framework.validator.annotation.ValidateString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;


/**
* 用户账号 实体类
*/
@Table(name = "sys_user")
@Entity
public class User extends BaseEntity {
    @Column(name = "username")
    @AutoDocField(value = "用户名")
    @ValidateString(length = 16,msg = "用户名在15字符串以内")
    private String username; //用户名
    @Column(name = "password")
    @AutoDocField(value = "密码")
    @ValidateString(method = ValidateString.ValidatorMethod.PASSWORD,msg = "密码验证必须是字母、数字，长度在6~16位之间")
    private String password; //密码

    /*----------------------get set 方法----------------------*/
    public String getUsername() {return username;}
    public void setUsername(String username){this.username = username == null ? null : username.trim();}
    public String getPassword() {return password;}
    public void setPassword(String password){this.password = password == null ? null : password.trim();}
    /*----------------------toString 方法----------------------*/
    @Override
    public String toString() {
        return "User{" +
        "id='" + getId() + '\'' + ',' + 
        "username='" + getUsername() + '\'' + ',' +
        "password='" + getPassword() + '\'' + ',' + 
        "createTime='" + getCreateTime() + '\'' + ',' +
        "creator='" + getCreator() + '\'' + ',' + 
        "updateTime='" + getUpdateTime() + '\'' + ',' + 
        "updater='" + getUpdater() + '\'' + ',' + 
        "activate='" + getActivate() + '\'' + 
        '}';
    }
}
